package com.xdf.ecommerce.controller;

import com.xdf.ecommerce.service.NacosClientService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author chanchaw
 * @create 2025-10-14 14:26
 */
@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/nacosClient")
@RequiredArgsConstructor
public class NacosClientController {
    private final NacosClientService service;
    @GetMapping("/serviceInstance/{serviceId}")
    public List<ServiceInstance> getNacosClientInfo(@PathVariable String serviceId){
        List<ServiceInstance> ret = service.getNacosClientInfo(serviceId);
        log.info("查询服务：[{}] 有：[{}]",serviceId, ret.toString());
        return ret;
    }
}
